<?php namespace Home\Controller;
use Hdphp\Controller\Controller;
use Common\Model\Goods;
class SearchController extends Controller{
	private $goodsModel;
	public function __init(){
		$this->goodsModel=new Goods;
	}



	

	public function index(){
		$temp=Q('post.search');
		
		if(isset($temp)){
			$goodsData=$this->goodsModel->where("gname like  '%".$temp."%'")->get();
		}else{
			$goodsData=$this->goodsModel->get();
		}
		View::with('goodsData',$goodsData);
		
		View::make();
	}

}